// Battery-Symbol-Option
// Initial version: 
// Author: Anlaogus

// 2012-06-10 Mark Nord - UTF-8 encoding, var-defs, now working in BETA-folder
tmp = function() 
{	
	NAME = "Analogus_Battery";
	
	//shortcuts:
	var LA = Core.lang.getLocalizer("ANALOGUS"),
	log = Core.log.getLogger(NAME),
	//MSG = Core.ui.showMsg,
	model = kbook.model
	BatteryFunction, 
	Analogus_Battery;
	
	
	//Battery-Symbol ON/OFF:
	BatteryFunction = function (bat) {
		var path = model.container.sandbox.STATUS_GROUP.sandbox.STATUS_GROUP_SUB.sandbox.STATUS_GROUP.sandbox;
	
		switch (bat) 
			{
			case 'ON':
				path.BATTERY_LEVEL.show(true);
				break;
			
			case 'OFF':
				path.BATTERY_LEVEL.show(false);
				break;
			}
	};

//--------------------------------------------------------------------------------------------------------
	Analogus_Battery = 
	{
		name: NAME,
		settingsGroup:"information", 
		onInit: function () //calls options-values and activates functions with values on restart:
			{
				BatteryFunction(Analogus_Battery.options.Battery);	//function(value of function from saved options);
				//SizeSymbolFunction(Analogus_Battery.options.SizeSymbol);
			},
			
		optionDefs:
		[
			{
				name: 'Battery',	//calls onsettingschanged
				title: LA('OPTION_BATTERY_SYMBOL_ONOFF'),
				icon: 'BATTERY',
				defaultValue: 'ON',	
				values: ['ON', 'OFF'],
				valueTitles: {
					'ON': LA('OPTION_BATTERY_SYMBOL_ON'),
					'OFF': LA('OPTION_BATTERY_SYMBOL_OFF')}
			}, 
		],
		
		onSettingsChanged: function (propertyName, oldValue, newValue, object) 
		{
			switch (propertyName) 
			{
				case 'Battery':
						BatteryFunction (newValue) ;
				break; 
			}
		}
	};

	Core.addAddon(Analogus_Battery);
};


try 
{
	tmp();
} catch (e) 
{
	// Core's log
	log.error("in Analogus_Battery.js", e);
};
